package ipsite.data;
import java.net.UnknownHostException;

import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.Mongo;
import com.mongodb.MongoException;
import com.mongodb.MongoOptions;

public class Data {
	static Mongo m = null;

	public static DBCollection data(String name) {

		if (m == null) {
			try {
				MongoOptions options = new MongoOptions();
				options.connectionsPerHost = 10;
				options.autoConnectRetry=true;
				m = new Mongo("184.107.73.9",options);
			} catch (UnknownHostException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (MongoException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		DB db = m.getDB("5ty");

		DBCollection coll = db.getCollection(name);
		return coll;
	}
}
